{include file="public/header" /}
<blockquote class="layui-elem-quote">
    添加
</blockquote>
<form class="layui-form layui-form-pane kllxs-form" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">角色选择</label>
        <div class="layui-input-block">
            <select name="rid">
                {foreach $parent_data as $k=>$v}
                <option value="{$v.id}" {$find.rid==$v.id?'selected':''}>{$v.level|raw}{$v.name}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-block">
            <div id="avatar"></div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">
            <input type="text" name="name" autocomplete="off" placeholder="请输入昵称" class="layui-input"
                value="{$find.name}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" autocomplete="off" placeholder="请输入用户名" class="layui-input"
                value="{$find.username}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" lay-affix="eye" autocomplete="off" placeholder="留空则不改密码"
                class="layui-input" value="">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">黑名单</label>
        <div class="layui-input-block">
            <input type="radio" name="blacklist" value="normal" title="否" {$find.blacklist=='normal' ?'checked':''}>
            <input type="radio" name="blacklist" value="hidden" title="是" {$find.blacklist=='hidden' ?'checked':''}>
        </div>
    </div>
    <div class="layui-form-item">
        <button class="layui-btn" lay-submit lay-filter="kllxs-submit">确认</button>
        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
</form>
{include file="public/footer" /}
<script>
    layui.use(["form", "popup"], function () {
        var form = layui.form;
        var popup = layui.popup;

        popup.attachment({
            elem: "#avatar",
            attribute: 'name="avatar" autocomplete="off" placeholder="请输入头像" value="{$find.avatar}"',
            url: "{:url('admin.index.files')}",
            uploadUrl: '{:url("admin.index.upload")}',
        });
        form.on('submit(kllxs-submit)', function (data) {
            var field = data.field; // 获取表单全部字段值

            popup.formSubmit("", field)

            return false; // 阻止默认 form 跳转
        })
    })
</script>